import Vue from 'vue'
import shouye from '../views/shouye'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [{
    path: '/',
    component: shouye
  },
  // {
  //   path: '/shouye',
  //   name: 'shouye',
  //   component: () => import( /* webpackChunkName: "shouye" */ '../views/shouye.vue')
  // },
  {
    path: '/find',
    name: 'find',
    component: () => import( /* webpackChunkName: "about" */ '../views/find')
  }, {
    path: '/myinfo',
    name: 'myinfo',
    component: () => import( /* webpackChunkName: "about" */ '../views/myinfo')
  }, {
    path: '/login',
    name: 'login',
    meta: {
      til: "登录页"
    },
    component: () => import( /*webpackChunkName:"login" */ '../views/login.vue')
  }

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})


router.beforeEach((to, from, next) => {
  console.log(to.path)
  // let token =
  //   localStorage.getItem("token")
  // if (to.path == '/login') {
  //   next()
  // }
  // if (token && to.path == '/myinfo') {
  //   next()
  // } else {
  //   next('/login')
  // }
  next()
})


export default router